package com.alibaba.citrus.ots;

import com.alibaba.cz.es.helper.ElasticSearchClientFactory;
import com.alibaba.cz.es.properties.ElasticSearchProperties;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author myw
 * @date 2022/04/10
 */

@Component
public class ESRestHighLevelClientSandbox {

//    @Value("${es.host}")
//    private String ES_HOST;
//
//    private Integer ES_PORT=9200;
//
//    @Value("${es.username}")
//    private String ES_USERNAME;
//
//    @Value("${es.password}")
//    private String ES_PASSWORD;

    @Bean(name = "restHighLevelClientSandbox")
    public RestHighLevelClient restHighLevelClient() {
        ElasticSearchProperties elasticSearchProperties = new ElasticSearchProperties();
        elasticSearchProperties.setHost("es-cn-s80lt45n6i5b45s9z.public.elasticsearch.aliyuncs.com");
        elasticSearchProperties.setPort(9200);
        elasticSearchProperties.setUsername("elastic");
        elasticSearchProperties.setPassword("QAZokm123");
        return ElasticSearchClientFactory.getClient(elasticSearchProperties);
    }

}
